//
//  GoodDetailImagesCell.m
//  NormalFramework
//
//  Created by beisheng03 on 2018/3/10.
//  Copyright © 2018年 beisheng. All rights reserved.
//

#import "GoodDetailImagesCell.h"
#import <SDCycleScrollView/SDCycleScrollView.h>

@interface GoodDetailImagesCell ()<SDCycleScrollViewDelegate>
@property (nonatomic, weak) SDCycleScrollView *cycleView;
@property (weak, nonatomic) IBOutlet UIView *bgView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *bgViewH;

@end


@implementation GoodDetailImagesCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.bgViewH.constant = KScreenW / 16.0 * 9.0;
    [self setupTopScrollview];
    // Initialization code
}




- (void)setupTopScrollview{
    
        // 网络加载 --- 创建自定义图片的pageControlDot的图片轮播器
        SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, KScreenW, KScreenW / 16.0 * 9.0) delegate:self placeholderImage:nil];
    
    
        
        cycleScrollView.autoScrollTimeInterval = 3;
        cycleScrollView.pageControlStyle = SDCycleScrollViewPageContolStyleAnimated;
        cycleScrollView.pageControlAliment = SDCycleScrollViewPageContolAlimentCenter;
    
        cycleScrollView.bannerImageViewContentMode = UIViewContentModeScaleAspectFit;
        cycleScrollView.currentPageDotImage = [UIImage imageNamed:@"pageControlCurrentDot"];
        cycleScrollView.pageDotImage = [UIImage imageNamed:@"pageControlDot"];
        cycleScrollView.backgroundColor = [UIColor whiteColor];
        _cycleView = cycleScrollView;
        
        _cycleView.imageURLStringsGroup = @[@"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1521288849311&di=4127a41c12632b7bac016f638f877ae9&imgtype=0&src=http%3A%2F%2Fimg1.shenchuang.com%2F2017%2F0929%2F1506647083867.jpg",
                                            @"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1521288849311&di=4127a41c12632b7bac016f638f877ae9&imgtype=0&src=http%3A%2F%2Fimg1.shenchuang.com%2F2017%2F0929%2F1506647083867.jpg",
                                            @"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1521288849311&di=4127a41c12632b7bac016f638f877ae9&imgtype=0&src=http%3A%2F%2Fimg1.shenchuang.com%2F2017%2F0929%2F1506647083867.jpg"];
        
        
        [self.bgView addSubview:_cycleView];
        
    
    
}



- (void)setUrls:(NSArray *)urls{
    _urls = urls;
    
    self.cycleView.imageURLStringsGroup = _urls;
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
